package com.hooya.fa.eu.biz.business;


import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateRange;
import cn.hutool.core.date.DateTime;
import com.hooya.fa.eu.biz.business.service.DailyStkCollectionService;
import com.hooya.fa.eu.biz.dao.entity.*;
import com.hooya.fa.eu.biz.dao.mapper.TempKcjlDailyMapper;
import com.hooya.fa.eu.biz.dao.mapper.TradeRecordMapper;
import com.hooya.fa.eu.biz.dao.mapper.stk.*;
import com.hooya.fa.eu.biz.service.ReportService;
import com.hooya.fa.eu.biz.service.StkCollectionService;
import com.hooya.fa.eu.biz.service.impl.StkCollectionServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RestController
@AllArgsConstructor
public class test {

	@Autowired
	private DailyStkCollectionService dailyStkCollectionService;

	private final StkCollectionServiceImpl stkCollectionService;

	private final TempJcjlMapper jcjlMapper;

	private final TempZyjlMapper zyjlMapper;

	private final TempKcjlDailyMapper kcjlDailyMapper;

	private final TradeRecordMapper tradeRecordMapper;

	private final TempPkpyMapper pkpyMapper;

	private final TempThjlMapper thjlMapper;

	private final TempXsjlMapper xsjlMapper;

	private final TempXsjlAbnormalMapper xsjlAbnormalMapper;

	private final TempXsjlDeleteMapper xsjlDeleteMapper;

	private final TempZyjlDeleteMapper zyjlDeleteMapper;

	private final TempZyjlChangeMapper zyjlChangeMapper;

	private final ReportService reportService;

	@GetMapping("/test")
	public void testTempXsjlAbnormalList() {

//		String startDate = "2025-09-01";
//		String endDate = "2025-10-01";
		int num = 1;
//		DateRange dateRange = cn.hutool.core.date.DateUtil.range(new Date(startDate.replace("-", "/")), new Date(endDate.replace("-", "/")), DateField.DAY_OF_MONTH);
//		for (DateTime time : dateRange) {
//			dailyStkCollectionService.generatorCollectionData_daily(time.toDateStr(), num); // 单天的内容会应为补单的加入而变得不同，但是测试仍然通过 - 代码上应该没有什么大问题
//		}

		String startDate = "2025-09-30";
		dailyStkCollectionService.generatorCollectionData_daily(startDate, num); // 单天的内容会应为补单的加入而变得不同，但是测试仍然通过 - 代码上应该没有什么大问题


	}

	@GetMapping("/test/insert")
	public void testInsertBatchSomeColumn() {

		List<TempJcjl> tempJcjlList = new ArrayList<>();
		tempJcjlList.add(new TempJcjl(null, "CPasdwaadBH", "place", "belongs", 1, "hthm", "2025-08-01", "2132312312123", null));
		jcjlMapper.insertBatchSomeColumnDaily(tempJcjlList);
//		pkpyMapper.insertBatchSomeColumnDaily(pkpyList);
//		thjlMapper.insertBatchSomeColumnDaily(tempThjlList);
//		xsjlAbnormalMapper.insertBatchSomeColumnDaily(tempXsjlAbnormalList);
//		xsjlDeleteMapper.insertBatchSomeColumnDaily(tempXsjlDeleteList);
//		zyjlDeleteMapper.insertBatchSomeColumnDaily(tempZyjlDeleteList);
//		zyjlChangeMapper.insertBatchSomeColumnDaily(zyjlChangeList);
//		kcjlDailyMapper.insertBatchSomeColumnDaily(tempKcjlDailies);
//		tradeRecordMapper.insertBatchSomeColumnDaily(list);
//		xsjlMapper.insertBatchSomeColumnDaily(list);
//		zyjlMapper.insertBatchSomeColumnDaily(tempZyjls);

	}


	@GetMapping("/report")
	public void testReport(){
		String startDate = "2025-08-01";
		String endDate = "2025-09-01";
//		reportService.profitCheckReport(startDate, endDate); // 这个报表不可用

	}


}
